<template>
    <div class="score-detail">
      <!-- Tab栏 -->
      <div class="tabs">
        <div :class="['tab', activeTab === 1 && 'active']" @click="activeTab = 1">绩效表1</div>
        <div :class="['tab', activeTab === 2 && 'active']" @click="activeTab = 2">绩效表2</div>
        <div :class="['tab', activeTab === 3 && 'active']" @click="activeTab = 3">绩效表3</div>
      </div>

      <!-- 内容区 -->
      <div class="content">
        <!-- 评分区 -->
        <div class="score-section">
          <div class="title-row">
            <span class="title">货代-订舱</span>
            <span class="detail-link" @click="showDetail = !showDetail">
            详细说明
            <span v-if="!showDetail">↓</span>
            <span v-else>↑</span>
          </span>
          </div>
          <div v-if="!showDetail">
            <div class="desc">
              <span class="green">计算方式：延误/失误1次扣5分，最多扣10分。</span>
            </div>
            <div class="score-row">
              <div class="score-item">
              <span class="stars">
              <span v-for="i in 5" :key="i" class="star" :class="{ filled: i <= 3 }">★</span>
            </span>
                <span>自评分数：7/10</span>
              </div>
              <div class="score-item">
              <span class="stars">
              <span v-for="i in 5" :key="i" class="star" :class="{ filled: i <= 2, red: true }">★</span>
            </span>
                <span>审核分数：7/10</span>
              </div>
            </div>
            <div class="input-row">
              <div class="input-label">自评说明</div>
              <input class="input" placeholder="这是最应得的" disabled/>
            </div>
            <div class="input-row">
              <div class="input-label">评审</div>
              <a-textarea class="textarea" placeholder="请对该同事工作做出评价"></a-textarea>
            </div>
          </div>
        </div>

        <!-- 详细说明区 -->
        <div class="line"></div>
        <div class="score-section" style="margin-top: 20px">
          <div class="title-row">
            <span class="title">货代-订舱</span>
            <span class="detail-link" @click="showDetail2 = !showDetail2">
            详细说明
            <span v-if="!showDetail2">↓</span>
            <span v-else>↑</span></span>
          </div>
          <div v-if="!showDetail2" class="detail-section">
            <ol>
              <li>在回签至PI约定交期前14天期间，与市场部对应同事确认货代信息，否则判为延误。</li>
              <li>
                根据PI约定的交期，不因其它因素晚晚发送BKG，且在BKG中列明公司对于本地费用的支付金额，并在SO接收前，需支付货代佣金，否则判为失误。
              </li>
              <li>
                如遇到紧急订单需即刻响应需相关部门的指明，须当天下即请示公司报备，获得批准后，才可接收SO做柜，否则判为失误。
              </li>
              <li>在收到SO当天分别与货代公司、车队确认做柜时间（包括截补、截关、接驳等），不晚于次日打车，否则判为延误。</li>
            </ol>
            <div class="detail-note">紧急订单需要取得公司批准工作方可进行。</div>
            <div class="desc green">计算方式：延误/失误1次扣5分，最多扣10分。</div>
          </div>
        </div>
      </div>
    </div>
</template>

<script setup>
import {ref} from 'vue'
import ScrollWrapper from "@/components/ScrollWrapper/ScrollWrapper.vue";

const activeTab = ref(2)
const showDetail = ref(false)
const showDetail2 = ref(false)
</script>

<style lang="less" scoped>

.score-detail {
  padding: 24px 0;
  display: flex;
  width: 100%;
  height: 100%;
  flex-direction: column;
  box-sizing: border-box;

  .tabs {
    display: flex;
    margin-bottom: 24px;
    border-radius: 16px;
    position: relative;
    overflow: hidden;

    .tab {
      flex: 1;
      text-align: center;
      padding: 12px 0;
      background: #e5e6e9;
      color: #333;
      font-weight: 500;
      cursor: pointer;

      &.active {
        background: #3a5647;
        color: #fff;
      }

      &:last-child {
        margin-right: 0;
      }
    }
  }

  .content {
    border-radius: 12px;
    padding: 32px;
    //flex: 1;
    //overflow-y: auto !important;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
    background-color: rgba(243, 246, 254, 1);

    .score-section {
      .title-row {
        display: flex;
        align-items: center;
        margin-bottom: 12px;

        .title {
          font-size: 24px;
          font-weight: bold;
          margin-right: 16px;
        }

        .detail-link {
          color: #888;
          cursor: pointer;
          font-size: 12px;
        }
      }

      .desc {
        margin: 0px 0 12px;

        .green {
          color: #3a8c3a;
        }
      }

      .score-row {
        display: flex;
        gap: 12px;
        flex-direction: column;
        margin-left: 1em;

        .score-item {
          display: flex;
          align-items: center;
          gap: 8px;

          .stars {
            .star {
              font-size: 20px;
              color: #ffd700;

              &.filled {
                color: #ffd700;
              }

              &.red {
                color: #e74c3c;
              }
            }
          }
        }
      }

      .input-row {
        margin: 12px 0;

        .input-label {
          font-weight: 600;
          margin-bottom: 4px;
        }

        .input, .textarea {
          width: 100%;
          border: 1px solid #ccc;
          border-radius: 6px;
          padding: 8px;
          font-size: 14px;
          margin-top: 4px;
        }

        .textarea {
          min-height: 80px;
          resize: vertical;
        }
      }
    }

    .detail-section {
      margin-top: 20px;

      ol {
        color: rgba(0, 0, 0, 0.25);
        padding: 0 14px;
      }

      .detail-note {
        color: rgba(0, 0, 0, 0.25);
        margin: 8px 0 20px;
      }

      .desc.green {
        color: #3a8c3a;
      }
    }
  }
}

.line {
  width: calc(100% + 48px);
  height: 1px;
  background-color: rgba(0, 0, 0, 0.2);
  margin: 0 -24px
}
</style>